<%@page import="bean.B01boardVO"%>
<%@page import="com.oreilly.servlet.multipart.DefaultFileRenamePolicy"%>
<%@page import="java.util.Enumeration"%>
<%@page import="com.oreilly.servlet.MultipartRequest"%>
<%@page import="bean.B01boardDTO" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Input_result</title>
<link rel="stylesheet" href="/Web/02CSS/B01board.css">
<script src = '/Web/03JavaScript/B01board.js'></script>
</head>
<body>
<% B01boardVO v = new B01boardVO(request);
B01boardDTO dto = new B01boardDTO();
dto.file(v);

%>
<form action="" name="hiddenFrm" method="post">
	<input type="hidden" name="nowPage" value="<%=v.getNowPage()%>">
	<input type="hidden" name="find" value="<%=v.getFind() %>">
</form>
<h1>게시판 입력결과 </h1>
<hr>
<%
if(dto.insert()){
	out.print("글 입력에 성공했습니다.");
}else{
	out.print("글 입력에 실패하였습니다.");
}
%>
<br>

<%-- 자바빈을 이용하지 않은 형태. input에서 form에 enctype="multipart/form-data"를 넣는다
 <% 	int size =1024*1024*10; /* 파일사이즈 */
	String saveDir="C:/Users/user/Documents/workspace/Web/WebContent/04JSP/01MemberPhoto/";
	String oriFile="";
	String sysFile=""; 
	MultipartRequest multi = null;
try{
	multi = new MultipartRequest(request, saveDir, size, "utf-8", new DefaultFileRenamePolicy());
	
	Enumeration files = multi.getFileNames();
	String tempFile = (String)files.nextElement();

	oriFile = multi.getOriginalFileName(tempFile);
	sysFile = multi.getFilesystemName(tempFile);

	out.print("<li>아이디 : " + multi.getParameter("m_id"));
	out.print("<li>제목 : " + multi.getParameter("m_title"));

	out.print("<li>원본파일명 : " + oriFile);
	out.print("<li>저장파일명 : " + sysFile);
}catch(Exception ex){
	out.print(ex.toString());
	out.print("파일전송에 실패하였습니다.");
}
%>  --%>
<hr>
	<input type="button" value="목록으로" id="btnList"/>
</body>
<script>inputInit();</script>
</html>
